from django.db import models
from utils.modelsMixin import ModelSetMiXin
from django.contrib.auth.models import User
# Create your models here.


class Classes(ModelSetMiXin):
    name = models.CharField(max_length=20, verbose_name='班级名称', help_text='班级')
    num = models.CharField('班期', max_length=20, help_text='班期')

    # 关联字段，某个老师或学生可能在不同的班里，某个班级有多个学生或老师
    member = models.ManyToManyField(User)

    class Meta:
        db_table = 'classes'
        verbose_name = '班级'
        verbose_name_plural = verbose_name  # 考虑到中英文单复数的转化

    def __str__(self):
        return f'{self.name}--{self.num}'
